//
//  FQDThirdLoginButton.m
//  FakeQDaily
//
//  Created by mewxiv on 9/10/16.
//  Copyright © 2016 Xensius. All rights reserved.
//

#import "FQDThirdLoginButton.h"

@implementation FQDThirdLoginButton

+ (instancetype)loginButton
{
    FQDThirdLoginButton *loginButton = [FQDThirdLoginButton buttonWithType:UIButtonTypeCustom];
    return loginButton;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.titleLabel.font = FQDRegularFontWithSize(14.0f);
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self setTitleColor:RGB(128, 128, 128) forState:UIControlStateNormal];
    }
    return self;
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    CGSize imageSize = CGSizeMake(42.75f, 42.75f);
    CGFloat x = (contentRect.size.width - imageSize.width) / 2;
    CGFloat y = 9.5f;
    return CGRectMake(x, y, imageSize.width, imageSize.height);
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGRect imageRect = [self imageRectForContentRect:contentRect];
    CGFloat x = 0;
    CGFloat y = CGRectGetMaxY(imageRect);
    CGFloat w = CGRectGetWidth(contentRect);
    CGFloat h = CGRectGetHeight(contentRect) - CGRectGetMaxY(imageRect);
    return CGRectMake(x, y, w, h);
}

@end
